/*    */ package com.wgcloud.controller;
/*    */ 
/*    */ import cn.hutool.json.JSONUtil;
/*    */ import com.wgcloud.dto.TuopuNodeDto;
/*    */ import com.wgcloud.entity.SystemInfo;
/*    */ import com.wgcloud.service.AppInfoService;
/*    */ import com.wgcloud.service.CpuStateService;
/*    */ import com.wgcloud.service.DashboardService;
/*    */ import com.wgcloud.service.DeskStateService;
/*    */ import com.wgcloud.service.LogInfoService;
/*    */ import com.wgcloud.service.MemStateService;
/*    */ import com.wgcloud.service.NetIoStateService;
/*    */ import com.wgcloud.service.SysLoadStateService;
/*    */ import com.wgcloud.service.SystemInfoService;
/*    */ import com.wgcloud.util.ThreadPoolUtil;
/*    */ import com.wgcloud.util.TuopuUtil;
/*    */ import java.util.ArrayList;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ import javax.annotation.Resource;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import org.apache.commons.lang3.StringUtils;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.ui.Model;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/tuopu"})
/*    */ public class TuopuController
/*    */ {
/* 37 */   private static final Logger logger = LoggerFactory.getLogger(com.wgcloud.controller.TuopuController.class);
/*    */   
/*    */   @Resource
/*    */   private SystemInfoService systemInfoService;
/*    */   
/*    */   @Resource
/*    */   private LogInfoService logInfoService;
/*    */   
/*    */   @Resource
/*    */   DashboardService dashboardService;
/*    */   @Resource
/*    */   CpuStateService cpuStateService;
/*    */   @Resource
/*    */   DeskStateService deskStateService;
/*    */   @Resource
/*    */   MemStateService memStateService;
/*    */   @Resource
/*    */   NetIoStateService netIoStateService;
/*    */   @Resource
/*    */   SysLoadStateService sysLoadStateService;
/*    */   @Resource
/*    */   AppInfoService appInfoService;
/*    */   
/*    */   private void testThread() {
/* 61 */     Runnable runnable = () -> logger.info("TuopuController----------testThread");
/*    */ 
/*    */     
/* 64 */     ThreadPoolUtil.executor.execute(runnable);
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   @RequestMapping({"tuopuList"})
/*    */   public String tuopuList(Model model, HttpServletRequest request) {
/* 76 */     Map<String, Object> params = new HashMap<>();
/*    */     try {
/* 78 */       List<SystemInfo> pageInfo = this.systemInfoService.selectAllByParams(params);
/* 79 */       List<TuopuNodeDto> nodeList = new ArrayList<>();
/* 80 */       for (SystemInfo systemInfo : pageInfo) {
/* 81 */         TuopuNodeDto dto = new TuopuNodeDto();
/* 82 */         if (StringUtils.isEmpty(systemInfo.getRemark())) {
/* 83 */           dto.setHostname(systemInfo.getHostname());
/*    */         } else {
/* 85 */           dto.setHostname(systemInfo.getHostname() + "(" + systemInfo.getRemark() + ")");
/*    */         } 
/* 87 */         dto.setState(systemInfo.getState());
/* 88 */         nodeList.add(dto);
/*    */       } 
/* 90 */       TuopuUtil.initList(nodeList);
/* 91 */       model.addAttribute("nodeList", JSONUtil.parseArray(nodeList));
/*    */     }
/* 93 */     catch (Exception e) {
/* 94 */       logger.error("拓扑图生成错误", e);
/* 95 */       this.logInfoService.save("拓扑图生成错误", e.toString(), "1");
/*    */     } 
/* 97 */     return "tuopu";
/*    */   }
/*    */ }


/* Location:              /Users/zhangyongxin/soft-install/wgcloud/wgcloud-v3.3.5/server/bank/wgcloud-server-release.jar!/BOOT-INF/classes/com/wgcloud/controller/TuopuController.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */